From: Jasper St. Pierre Date: Sun, 2 Oct 2011 16:58:19 +0000 (-0400) Subject: st-theme-node-drawing: Fix centering when the image needs to be scaled X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~7504 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0ccb2800089822ac200cb20a2bbfddf1c31bbf4b;p=gnome-shell.git st-theme-node-drawing: Fix centering when the image needs to be scaled The translate coordinates are calculated as the offset after the scale, so it needs to be applied after the scale as well. This fixes random centering issues in the UI. https://bugzilla.gnome.org/show_bug.cgi?id=660674 --- diff --git a/src/st/st-theme-node-drawing.c b/src/st/st-theme-node-drawing.c index 7513a48f9..3e7d86f4e 100644 --- a/src/st/st-theme-node-drawing.c +++ b/src/st/st-theme-node-drawing.c @@ -601,8 +601,8 @@ create_cairo_pattern_of_background_image (StThemeNode *node, x_offset = - (node->alloc_width / 2. - scaled_width / 2.); } - cairo_matrix_init_translate (&matrix, x_offset, y_offset); - cairo_matrix_scale (&matrix, scale_factor, scale_factor); + cairo_matrix_init_scale (&matrix, scale_factor, scale_factor); + cairo_matrix_translate (&matrix, x_offset, y_offset); cairo_pattern_set_matrix (pattern, &matrix);